﻿Imports System
Imports System.Drawing

Namespace System.Workflow.ComponentModel.Design
    Public Class CommentGlyph
        Inherits DesignerGlyph
        ' Methods
        Public Overrides Function GetBounds(ByVal designer As ActivityDesigner, ByVal activated As Boolean) As Rectangle
            If (designer Is Nothing) Then
                Throw New ArgumentNullException("designer")
            End If
            Dim bounds As Rectangle = designer.Bounds
            bounds.Inflate(WorkflowTheme.CurrentTheme.AmbientTheme.Margin)
            Return bounds
        End Function

        Protected Overrides Sub OnPaint(ByVal graphics As Graphics, ByVal activated As Boolean, ByVal ambientTheme As AmbientTheme, ByVal designer As ActivityDesigner)
            Dim bounds As Rectangle = Me.GetBounds(designer, activated)
            graphics.FillRectangle(AmbientTheme.FadeBrush, bounds)
            graphics.FillRectangle(ambientTheme.CommentIndicatorBrush, bounds)
            graphics.DrawRectangle(ambientTheme.CommentIndicatorPen, bounds)
        End Sub


        ' Properties
        Friend Shared ReadOnly Property [Default] As CommentGlyph
            Get
                If (CommentGlyph.defaultCommentGlyph Is Nothing) Then
                    CommentGlyph.defaultCommentGlyph = New CommentGlyph
                End If
                Return CommentGlyph.defaultCommentGlyph
            End Get
        End Property

        Public Overrides ReadOnly Property Priority As Integer
            Get
                Return 3
            End Get
        End Property


        ' Fields
        Private Shared defaultCommentGlyph As CommentGlyph
    End Class
End Namespace

